*****************************************************************
*																*
*				Title: spatial_regressions_app.do		 	 	*		
*															    *
*****************************************************************

/*  ================================  NOTES  ================================

+ PURPSOSE:
	
	In this do-file we run the spatial regressions for the three sectors together
	for the appendix and output the results
	
		
+ Inputs:

		* 1. panel_cotton.dta
			
			 
		* 2. panel_metallurgy.dta
			 
			 
		* 3. panel_paper.dta
			 
==============================  TOP MATTER ==============================*/

	*set paths 
	global proc_data "`pdir'/data"
	global output "`pdir'/outputs/appendix"

********************************** END HEADER **********************************




********************************************************************************
****************   TABLES APPENDIX  ********************************************
********************************************************************************


******************** Table A. 10 ********************************************
*** Proximity to High-Productivity Plants (standardized coeffs)

estimates clear

**** 1. Cotton 


use "$proc_data/panel_cotton.dta", clear


			** 1806
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 i.id_dept if year == 1806, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 i.id_dept if year == 1806, cluster(id_dept)
			
			
	
			** 1840
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 i.id_dept if year == 1840, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 i.id_dept if year == 1840, cluster(id_dept)
			
			


***2. Metallurgy


use "$proc_data/panel_metallurgy.dta", clear

					
			** 1811
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYmeanoverL_real lndistance_above_p90_1800 i.id_dept  if year == 1811, beta 
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1800 i.id_dept if year == 1811, cluster(id_dept)
			
					 
		
			** 1840
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYmeanoverL_real lndistance_above_p90_1840 i.id_dept  if year == 1840, beta r
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1840 i.id_dept  if year == 1840, cluster(id_dept)
			
			
		


**3. Paper milling


use "$proc_data/panel_paper.dta", clear

	
			** 1794
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 i.id_dept  if year == 1794, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 i.id_dept if year == 1794, cluster(id_dept)
			

			
			** 1840
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840  i.id_dept if year == 1840, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840  i.id_dept if year == 1840, cluster(id_dept)
			
			
estout using "$output/Tables/Table_A10.tex", replace label keep(c_lndistance_above_p90_1800 c_lndistance_above_p90_1840)  order($show ) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) ///
indicate("Department FE=_cons", labels("\multicolumn{1}{c}{\checkmark}" "\multicolumn{1}{c}{ }"))




************	Table A.11: *****************************************************
** Proximity to High-Productivity Plants – Controlling for Location Fundamentals  (standardized coeffs)

	
estimates clear

*** 1. Cotton 

use "$proc_data/panel_cotton.dta", clear


			** 1806 
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 highsflow closecoal share_forest i.id_dept if year == 1806, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 highsflow closecoal share_forest i.id_dept if year == 1806, cluster(id_dept)
			
	
			** 1840 
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 highsflow closecoal share_forest i.id_dept if year == 1840, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 highsflow closecoal share_forest i.id_dept if year == 1840, cluster(id_dept)
		


**2. Metallurgy


use "$proc_data/panel_metallurgy.dta", clear


			** 1811 
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYmeanoverL_real lndistance_above_p90_1800 highsflow closecoal share_forest i.id_dept if year == 1811, beta r
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1800 highsflow closecoal share_forest i.id_dept if year == 1811, cluster(id_dept)
			
			 	
			** 1840 
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYmeanoverL_real lndistance_above_p90_1840 highsflow closecoal share_forest i.id_dept if year == 1840, beta r
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1840 highsflow closecoal share_forest i.id_dept if year == 1840, cluster(id_dept)
			
			

**3. Paper milling


use "$proc_data/panel_paper.dta", clear

		
			** 1794 
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 highsflow closecoal share_forest  i.id_dept if year == 1794, beta r
			center logYoverL_real  if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real  c_lndistance_above_p90_1800 highsflow closecoal share_forest i.id_dept if year == 1794, cluster(id_dept)
		
			
			** 1840 
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real  lndistance_above_p90_1840 highsflow closecoal share_forest i.id_dept if year == 1840, beta r
			center logYoverL_real  if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 highsflow closecoal share_forest i.id_dept if year == 1840, cluster(id_dept)



estout using "$output/Tables/Table_A11.tex", replace label keep(c_lndistance_above_p90_1800 c_lndistance_above_p90_1840 highsflow closecoal share_forest) order($show c_lndistance_above_p90_1800 c_lndistance_above_p90_1840 ) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) ///
indicate("Department FE=_cons", labels("\multicolumn{1}{c}{\checkmark}" "\multicolumn{1}{c}{ }"))			


************	Table A.12: Proximity to High-Productivity Plants ***************
** Controlling for Local Production Density     

estimates clear

*** 1. Cotton 


use "$proc_data/panel_cotton.dta", clear


		** 1806
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 lnoutputdensity_commune i.id_dept if year == 1806, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 lnoutputdensity_commune i.id_dept if year == 1806, cluster(id_dept)
			
	
		** 1840 
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 lnoutputdensity_commune i.id_dept if year == 1840, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 lnoutputdensity_commune i.id_dept if year == 1840, cluster(id_dept)
	


**2. Metallurgy


use "$proc_data/panel_metallurgy.dta", clear


	    ** 1811
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYmeanoverL_real lndistance_above_p90_1800 lnoutputdensity_commune i.id_dept  if year == 1811, beta 
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1800 lnoutputdensity_commune i.id_dept if year == 1811, cluster(id_dept)

		
		**  1840 
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYmeanoverL_real lndistance_above_p90_1840 i.id_dept lnoutputdensity_commune  if year == 1840, beta r
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1840 lnoutputdensity_commune i.id_dept  if year == 1840, cluster(id_dept)
			
			
	
**3. Paper milling

use "$proc_data/panel_paper.dta", clear



			** 1794 
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 lnoutputdensity_commune i.id_dept  if year == 1794, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 lnoutputdensity_commune i.id_dept if year == 1794, cluster(id_dept)
			
			
			** 1840 
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 lnoutputdensity_commune i.id_dept if year == 1840, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 lnoutputdensity_commune i.id_dept if year == 1840, cluster(id_dept)
			


estout using "$output/Tables/Table_A12.tex", replace label keep(c_lndistance_above_p90_1800 c_lndistance_above_p90_1840 lnoutputdensity_commune) order($show c_lndistance_above_p90_1800 c_lndistance_above_p90_1840 ) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) ///
indicate("Department FE=_cons", labels("\multicolumn{1}{c}{\checkmark}" "\multicolumn{1}{c}{ }"))			


	

************	Table A.13: ***************************************************
*** Proximity to High-Productivity Plants: Distance Placebo in 1840    

	

estimates clear

***1. Cotton 


use "$proc_data/panel_cotton.dta", clear


			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 i.id_dept if year == 1806, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 i.id_dept if year == 1806, cluster(id_dept)
			

***2. Metallurgy


use "$proc_data/panel_metallurgy.dta", clear

			
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYmeanoverL_real lndistance_above_p90_1840 i.id_dept if year == 1811, beta r
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1840 i.id_dept if year == 1811, cluster(id_dept)
		

*3. Paper milling

use "$proc_data/panel_paper.dta", clear

			
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 i.id_dept if year == 1794, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 i.id_dept if year == 1794, cluster(id_dept)
		


estout using "$output/Tables/Table_A13.tex", replace label keep( c_lndistance_above_p90_1840) order($show ) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) ///
indicate("Department FE=_cons", labels("\multicolumn{1}{c}{\checkmark}" "\multicolumn{1}{c}{ }"))			

	

************	Table A.14: ****************************************************
*** Testing for Spatial Selection of New Plants in Cotton Spinning in 1806    **
	
estimates clear

use "$proc_data/panel_cotton.dta", clear
			

		** Col. 1 (Baseline as in Table A.10)		
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 i.id_dept if year == 1806, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 i.id_dept if year == 1806, cluster(id_dept)
				

		** Col. 2: Restrict sample to plants that had entered before the high-prd plant
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1800		
			reg logYoverL_real lndistance_above_p90_1800 i.id_dept if year == 1806 & year_est < year_est_p90_highprod, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 i.id_dept if year == 1806 & year_est < year_est_p90_highprod, cluster(id_dept)
						
	

estout using "$output/Tables/Table_A14.tex", replace label keep(c_lndistance_above_p90_1800) order($show c_lndistance_above_p90_1800) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) ///
indicate("Department FE=_cons", labels("\multicolumn{1}{c}{\checkmark}" "\multicolumn{1}{c}{ }"))			


	


			
****	Table A.15: ************************************************************
*** Proximity of Cotton Spinning Plants to High-Productivity Plants in Metallurgy and Paper Milling in 1800    

estimates clear

***1. Cotton_Metal 


use "$proc_data/panel_cotton.dta", clear

		cap drop c_logYoverL_real 
		cap drop c_lndistance_above_p90_m_1800
		reg logYoverL_real lndistance_above_p90_m_1800 i.id_dept if year == 1806, beta
		center logYoverL_real if e(sample), standardize
		center lndistance_above_p90_m_1800 if e(sample), standardize
		label var c_lndistance_above_p90_m_1800 "\$lnDist^{p90}$ metal (1800)" 
		eststo: reg c_logYoverL_real c_lndistance_above_p90_m_1800 i.id_dept if year == 1806, cluster(id_dept)

			
**2. Cotton_Paper 
			
	
		cap drop c_logYoverL_real 
		cap drop c_lndistance_above_p90_p_1800
		reg logYoverL_real lndistance_above_p90_p_1800 i.id_dept if year == 1806, beta
		center logYoverL_real if e(sample), standardize
		center lndistance_above_p90_p_1800 if e(sample), standardize
		label var c_lndistance_above_p90_p_1800 "\$lnDist^{p90}$ paper (1800)" 
		eststo: reg c_logYoverL_real c_lndistance_above_p90_p_1800 i.id_dept if year == 1806, cluster(id_dept)
	

estout using "$output/Tables/Table_A15.tex", replace label keep(c_lndistance_above_p90_m_1800 c_lndistance_above_p90_p_1800) order($show ) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) ///
indicate("Department FE=_cons", labels("\multicolumn{1}{c}{\checkmark}" "\multicolumn{1}{c}{ }"))	








************	Table A.16:  ***************************************************
**** Proximity to High-Productivity Plants – Controlling for Distance to London 

estimates clear

** 1. Cotton 


use "$proc_data/panel_cotton.dta", clear


		** 1806
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 lndistance_london i.id_dept if year == 1806, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 lndistance_london i.id_dept if year == 1806, cluster(id_dept)
			
	
		** 1840 
			cap drop c_logYoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 lndistance_london i.id_dept if year == 1840, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 lndistance_london i.id_dept if year == 1840, cluster(id_dept)
	


**2. Metallurgy


use "$proc_data/panel_metallurgy.dta", clear


	    ** 1811
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1800
			reg logYmeanoverL_real lndistance_above_p90_1800 lndistance_london i.id_dept  if year == 1811, beta 
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1800 lndistance_london i.id_dept if year == 1811, cluster(id_dept)

		
		**  1840 
			cap drop c_logYmeanoverL_real
			cap drop c_lndistance_above_p90_1840
			reg logYmeanoverL_real lndistance_above_p90_1840 i.id_dept lndistance_london  if year == 1840, beta r
			center logYmeanoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYmeanoverL_real c_lndistance_above_p90_1840 lndistance_london i.id_dept  if year == 1840, cluster(id_dept)
			
			
	
**3. Paper milling

use "$proc_data/panel_paper.dta", clear



			** 1794 
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1800
			reg logYoverL_real lndistance_above_p90_1800 lndistance_london i.id_dept  if year == 1794, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1800 if e(sample), standardize
			label var c_lndistance_above_p90_1800 "\$lnDist^{p90}$ (1800)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1800 lndistance_london i.id_dept if year == 1794, cluster(id_dept)
			
			
			** 1840 
			cap drop c_logYoverL_real 
			cap drop c_lndistance_above_p90_1840
			reg logYoverL_real lndistance_above_p90_1840 lndistance_london i.id_dept if year == 1840, beta r
			center logYoverL_real if e(sample), standardize
			center lndistance_above_p90_1840 if e(sample), standardize
			label var c_lndistance_above_p90_1840 "\$lnDist^{p90}$ (1840)"
			eststo: reg c_logYoverL_real c_lndistance_above_p90_1840 lndistance_london i.id_dept if year == 1840, cluster(id_dept)
			


estout using "$output/Tables/Table_A16.tex", replace label keep(c_lndistance_above_p90_1800 c_lndistance_above_p90_1840 lndistance_london) order($show c_lndistance_above_p90_1800 c_lndistance_above_p90_1840 ) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) ///
indicate("Department FE=_cons", labels("\multicolumn{1}{c}{\checkmark}" "\multicolumn{1}{c}{ }"))





	

			
			